﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Time.ascx.cs" Inherits="Pages_Time" ClassName="DateTimeWidget" %>
<%@ Register assembly="DevExpress.Web.v11.2, Version=11.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxTimer" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>

<style type="text/css">
    .styletimer
    {
        width: 100%;
        height: 88px;
    }
</style>

<script runat="server">
    protected void Page_Init(object sender, EventArgs e) {
        lbDate.Text = new DateTime(DateTime.Now.Year, 3, 14).ToLongDateString();
    }
</script>

<script type="text/javascript" language="javascript">
// <![CDATA[
    function PrepareTimeValue(value) {
        if (value < 10)
            value = "0" + value;
        return value;
    }
    function UpdateTime(s, e) {
        var dateTime = new Date();
        var timeString = PrepareTimeValue(dateTime.getHours()) + ":" + PrepareTimeValue(dateTime.getMinutes()) + ":" +
            PrepareTimeValue(dateTime.getSeconds());
        lbTimer.SetText(timeString);
    }
// ]]> 
</script>

<table class="styletimer">
    <tr>
        <td>
            <dx:ASPxTimer ID="Timer" runat="server" ClientInstanceName="timer" Interval="1000">
                <ClientSideEvents Init="UpdateTime" Tick="UpdateTime" />
            </dx:ASPxTimer>
            <div class="timeContainer">
                <dx:ASPxLabel ID="lbTimer" runat="server" ClientInstanceName="lbTimer" 
                    Font-Bold="True" Font-Size="X-Large" 
                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx">
                </dx:ASPxLabel>
            </div>
            <div class="dateContainer">
                <dx:ASPxLabel ID="lbDate" runat="server" Font-Size="14px" 
                    ClientInstanceName="lbDate" CssFilePath="~/App_Themes/DevEx/{0}/styles.css" 
                    CssPostfix="DevEx">
                </dx:ASPxLabel>
            </div>
        </td>
    </tr>
</table>




